import redis
import logging



class Config:
    # sqlalchemy 配置 连接数据库
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information_test"
    # sqlalchemy 跟踪
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # 为session设置密匙
    SECRET_KEY = "dfsdfdfdsfdsf"
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    # 把session存储到redis里面
    SESSION_TYPE = 'redis'
    # 使用session的签名
    SESSION_USE_SIGNER = True
    SESSION_REDIS =  redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=0)
    # 设置session的有效期 ,单位秒,有效期可以随意设置
    SESSION_PERMANENT = 86400 * 3


class DevelopmentConfig(Config):
    DEBUG = "True"
    LOG_LEVEL = logging.DEBUG


class ProdutionConfig(Config):
    DEBUG = "True"
    LOG_LEVEL = logging.ERROR


 # 设置工厂模式的类
config_map = dict(Development=DevelopmentConfig, Prodution=ProdutionConfig)
